package com.ruoyi.web.sso.common.util;


import com.ruoyi.web.sso.domain.vo.StaffDetails;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class StaffDetailsUtil {

    public static StaffDetails getSession(HttpServletRequest request){
        StaffDetails staffDetails = (StaffDetails)request.getSession().getAttribute("staff");
        return staffDetails;
    }

    public static String returnLogin(HttpServletRequest request, HttpServletResponse response, String url){
        StaffDetails staffDetails = (StaffDetails)request.getSession().getAttribute("staff");
        if (AssertUtil.isEmpty(staffDetails)){
            // 跳转到登录页
            return "/staff/login";
        }else {
            return url;
        }
    }

}
